<?php
namespace Admin\Controller;
//评论管理

use Common\Controller\AdminbaseController;

class CommentsController extends AdminbaseController{

	protected $comments_model;

	public function _initialize() {
		parent::_initialize();
		$this->comments_model = M('comments');
	}

	// 评论管理列表
	public function index(){
		/**搜索条件**/
        $start_time = I('request.start_time');
        $end_time = I('request.end_time');
        $bill_no = I('request.bill_no');
        $member_id = I('request.member_id');

        if($start_time){/*开始时间*/
            $where['comment_data'] = array('egt',$start_time);
        }
        if($end_time){/*结束时间*/
            $where['comment_data'] = array('elt',$end_time);
        }
        if($start_time && $end_time){
            $where['comment_data'] = array(array('elt',$end_time),array('egt',$start_time));
        }

		if($bill_no){
			$where['bill_no'] = array('like',"%$bill_no%");
		}
		if($member_id){
			$where['member_id'] = array('like',"%$member_id%");
		}
		$count=$this->comments_model->where($where)->count();
		$page = $this->page($count, 10);
        $list = $this->comments_model
            ->where($where)
            ->order("id DESC")
            ->limit($page->firstRow, $page->listRows)
            ->select();
		$this->assign("page", $page->show('Admin'));
        $this->assign('list',$list);
		$this->display();
	}

}